﻿<phone:PhoneApplicationPage
    x:Class="CommunityMegaphone.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:uc="clr-namespace:CommunityMegaphone.UserControls"
    d:DataContext="{d:DesignData SampleData/SearchResultsViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696" 
    shell:SystemTray.IsVisible="True">

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,12,0,12">
            <TextBlock Style="{StaticResource CmTitleStyle}"/>
            <TextBlock x:Name="tbSubTitle" Text="events" Style="{StaticResource PhoneTextTitle2Style}"/>
        </StackPanel>

        <Grid x:Name="ContentPanel" Grid.Row="1">
            <ListBox x:Name="MainListBox" ItemsSource="{Binding Events}" SelectionChanged="OnSelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Margin="0,5,0,5">
                            <uc:CMLogoMegaphoneOnlyUC ScaleX="0.4" ScaleY="0.4" Width="58" Height="55" Margin="0,3,3,3" VerticalAlignment="Top"/>
                            <StackPanel>
                            	<StackPanel Orientation="Horizontal">
									<TextBlock Text="{Binding StateName}" Margin="0,0,5,0" Style="{StaticResource PhoneTextNormalStyle}"/>
                                    <TextBlock Text="{Binding EventTypeName}" Margin="0,0,-5,0" Style="{StaticResource PhoneTextNormalStyle}"/>
                                    <TextBlock Text="{Binding FormattedStartTime}" Style="{StaticResource PhoneTextNormalStyle}"/>
                                </StackPanel>
                               	<TextBlock x:Name="TitleText" Text="{Binding Title}" Margin="0,0,0,3" Style="{StaticResource PhoneTextSubtleStyle}"/>
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
    
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="btnNearbyEvents" Text="nearby" Click="OnLoadNearbyEvents" IconUri="/icons/appbar.location.rest.png"/>
            <shell:ApplicationBarIconButton x:Name="btnSearchByCity" Text="city" Click="OnSearchByCity"  IconUri="/icons/appbar.skyline.rest.png"/>
            <shell:ApplicationBarIconButton x:Name="btnReloadAll" Text="show all" Click="OnReloadAll" IconUri="/icons/appbar.reloadall.rest.png"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
